home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / cpu / ccpu / ccpu.h < prev    next >
C/C++ Source or Header  |  1999-06-22  |  4KB  |  148 lines

  1. /***************************************************************************
  2.  *
  3.  * Retrocade - Video game emulator
  4.  * Copyright 1998, The Retrocade group
  5.  *
  6.  * Permission to distribute the Retrocade executable *WITHOUT GAME ROMS* is
  7.  * granted to all. It may not be sold without the express written permission
  8.  * of the Retrocade development team or appointed representative.
  9.  *
  10.  * Source code is *NOT* distributable without the express written
  11.  * permission of the Retrocade group.
  12.  *
  13.  * Cinematronics CPU header file
  14.  *
  15.  ***************************************************************************/
  16.  
  17. #ifndef _C_CPU_H_
  18. #define    _C_CPU_H_
  19.  
  20.  
  21. /*============================================================================================*
  22.  
  23.     HERE BEGINS THE MAME-SPECIFIC ADDITIONS TO THE CCPU INTERFACE.
  24.  
  25.  *============================================================================================*/
  26.  
  27. /* added these includes */
  28. #include "osd_cpu.h"
  29. #include "memory.h"
  30.  
  31. enum {
  32.     CCPU_PC=1, CCPU_ACC, CCPU_CMP, CCPU_PA0, CCPU_CFLAG,
  33.     CCPU_A, CCPU_B, CCPU_I, CCPU_J, CCPU_P, CCPU_CSTATE };
  34.  
  35. #ifndef FALSE
  36. #define FALSE    0
  37. #endif
  38. #ifndef TRUE
  39. #define TRUE    (!FALSE)
  40. #endif
  41.  
  42. /* an ICount variable (mostly irrelevant) */
  43. extern int ccpu_ICount;
  44.  
  45. /* MAME interface functions */
  46. void ccpu_reset(void *param);
  47. void ccpu_exit(void);
  48. int ccpu_execute(int cycles);
  49. unsigned ccpu_get_context(void *dst);
  50. void ccpu_set_context(void *src);
  51. unsigned ccpu_get_pc(void);
  52. void ccpu_set_pc(unsigned val);
  53. unsigned ccpu_get_sp(void);
  54. void ccpu_set_sp(unsigned val);
  55. unsigned ccpu_get_reg(int regnum);
  56. void ccpu_set_reg(int regnum, unsigned val);
  57. void ccpu_set_nmi_line(int state);
  58. void ccpu_set_irq_line(int irqline, int state);
  59. void ccpu_set_irq_callback(int (*callback)(int irqline));
  60. const char *ccpu_info(void *context, int regnum);
  61. unsigned ccpu_dasm(char *buffer, unsigned pc);
  62.  
  63. /* I/O routine */
  64. void ccpu_SetInputs(int inputs, int switches);
  65.  
  66. /* constants for configuring the system */
  67. #define CCPU_PORT_IOSWITCHES       0
  68. #define CCPU_PORT_IOINPUTS         1
  69. #define CCPU_PORT_IOOUTPUTS        2
  70. #define CCPU_PORT_IN_JOYSTICKX     3
  71. #define CCPU_PORT_IN_JOYSTICKY     4
  72. #define CCPU_PORT_MAX              5
  73.  
  74. #define CCPU_MEMSIZE_4K            0
  75. #define CCPU_MEMSIZE_8K            1
  76. #define CCPU_MEMSIZE_16K           2
  77. #define CCPU_MEMSIZE_32K           3
  78.  
  79. #define CCPU_MONITOR_BILEV      0
  80. #define CCPU_MONITOR_16LEV      1
  81. #define CCPU_MONITOR_64LEV      2
  82. #define CCPU_MONITOR_WOWCOL     3
  83.  
  84. /* nicer config function */
  85. void ccpu_Config (int jmi, int msize, int monitor);
  86.  
  87. #ifdef MAME_DEBUG
  88. extern unsigned DasmCCPU(char *buffer, unsigned pc);
  89. #endif
  90.  
  91. /*============================================================================================*
  92.  
  93.     BELOW LIES THE CORE OF THE CCPU. THE CODE WAS KINDLY GIVEN TO MAME BY ZONN MOORE,
  94.     JEFF MITCHELL, AND NEIL BRADLEY. I HAVE PRETTY HEAVILY CLEANED IT UP.
  95.  
  96.  *============================================================================================*/
  97.  
  98.  
  99. /* Define new types for the c-cpu emulator */
  100. typedef short unsigned int CINEWORD;      /* 12bits on the C-CPU */
  101. typedef unsigned char      CINEBYTE;      /* 8 (or less) bits on the C-CPU */
  102. typedef short signed int   CINESWORD;     /* 12bits on the C-CPU */
  103. typedef signed char        CINESBYTE;     /* 8 (or less) bits on the C-CPU */
  104.  
  105. typedef unsigned long int  CINELONG;
  106.  
  107. typedef enum
  108. {
  109.     state_A = 0,
  110.     state_AA,
  111.     state_B,
  112.     state_BB
  113. } CINESTATE;                              /* current state */
  114.  
  115. /* NOTE: These MUST be in this order! */
  116.  
  117. struct scCpuStruct
  118. {
  119.     CINEWORD    accVal;                /* CCPU Accumulator value */
  120.     CINEWORD    cmpVal;                /* Comparison value */
  121.     CINEBYTE    pa0;
  122.     CINEBYTE    cFlag;
  123.     CINEWORD    eRegPC;
  124.     CINEWORD    eRegA;
  125.     CINEWORD    eRegB;
  126.     CINEWORD    eRegI;
  127.     CINEWORD    eRegJ;
  128.     CINEBYTE    eRegP;
  129.     CINESTATE    eCState;
  130. };
  131.  
  132. typedef struct scCpuStruct CONTEXTCCPU;
  133.  
  134. extern CINELONG cineExec(CINELONG);
  135. extern void cineReset(void);
  136. extern void cineSetJMI(int);
  137. extern void cineSetMSize(int);
  138. extern void cineSetMonitor(int);
  139. extern void cSetContext(CONTEXTCCPU *);
  140. extern void cGetContext(CONTEXTCCPU *);
  141. extern CINELONG cineGetElapsedTicks(int);
  142. extern void cineReleaseTimeslice(void);
  143. extern CINELONG cGetContextSize(void);
  144.  
  145. extern int bNewFrame;
  146.  
  147. #endif
  148.